function batchDel(){
    var arr= $("#roleTb").bootstrapTable("getSelections");
    if(arr.length == 0){
        swal({
            type:"warning",
            title:"信息提示",
            text:"请至少选择一项待删除",
            confirmButtonText:"确定"
        });
        return;
    }
    console.log(arr);
    var ids=arr.map(role=>{
        console.log(role.id);
        return "ids="+role.id
    }).join("&");

    console.log(ids);
    $.get("sys/role/batchDel?"+ids,msg=>{
        toastr.warning(msg);
        $("#roleTb").bootstrapTable("refresh");
    });
}

function add(){
    location.href = `${ctx}/sys/role/add`;
}

function fmtDate(value){
   return value.substring(0,10);
}
function actionFormatter(){
    var del=`<button class="btn btn-danger aaa">删除</button> `;
    var edit=`<button class="cc btn btn-warning">修改</button>`
    return del+edit;
}
$("#update").dialog({
    title:"修改角色",
    btnBind(){
        var params=$("#update form").serialize();
        $.post(`${ctx}/sys/role/update`,params)
            .done(msg=>{
                toastr.success(msg);
                $("#roleTb").bootstrapTable("refresh");
                $("#update").dialog("hide");
            });
    }
});
var actionEvents ={
    "click .cc":function(a,b,row){
        $("#update [name=id]").val(row.id);
       $("#update [name=roleCode]").val(row.roleCode);
        $("#update [name=roleName]").val(row.roleName);
        $("#update").dialog("show");
    }
}
